//引入mongoose 模块
const mongoose = require("mongoose");
//创建评论集合规则
const commentSchama =  new mongoose.Schema({
    //文章id
    aid:{
        type:mongoose.Schema.Types.ObjectId,
        ref:'Article'
    },
    //评论用户id
    uid:{
        type:mongoose.Schema.ObjectId,
        ref:'User'
    },
    //评论时间
    time:{
        type:Date
    },
    //评论内容
    content:{
        type:String
    },
  
});

//创建评论集合
const Comment = mongoose.model('Comment',commentSchama);

//导出评论集合构造函数
module.exports={
    Comment
}


